package com.atstudy.service;

import com.atstudy.dao.AccountDao;
import com.atstudy.entites.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.util.List;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2023/1/31 9:23
 * @copyright: 博为峰
 */
@Service("accountService")
//@Scope("singleton")
//@Lazy(value = false)
public class AccountServiceImpl implements AccountService {

//    @Autowired
//    @Qualifier("accountDao02")
    @Resource(name = "accountDao")
    private AccountDao accountDao;

    public AccountServiceImpl() {
        System.out.println("对象创建");
    }

    @PostConstruct
    public void init() {
        System.out.println("对象初始化");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("对象销毁");
    }

    @Override
    public List<Account> getAccountList() {
        return accountDao.selectAccountList();
    }
}
